\ProvidesPackage{beamerthemeCG}

% 31.07.2007 Martin Lambers

\mode<presentation>

\newif\ifbeamer@secheader
\beamer@secheaderfalse

\DeclareOptionBeamer{secheader}{\beamer@secheadertrue}
\ProcessOptionsBeamer

\setbeamertemplate{blocks}[rounded][shadow=false]
\setbeamertemplate{items}[ball]
\setbeamertemplate{sections/subsections in toc}[ball unnumbered]
\setbeamertemplate{title page}[default][colsep=-4bp,rounded=true,shadow=true]
\setbeamertemplate{part page}[default][colsep=-4bp,rounded=true,shadow=true]

\defbeamertemplate*{navigation symbols}{CG}
{%
  \hbox{%
    \hbox{\insertslidenavigationsymbol}
    \hbox{\insertframenavigationsymbol}
    %\hbox{\insertsubsectionnavigationsymbol}
    %\hbox{\insertsectionnavigationsymbol}
    %\hbox{\insertdocnavigationsymbol}
    %\hbox{\insertbackfindforwardnavigationsymbol}%
  }%
}

\defbeamertemplate*{frametitle}{CG}[1][left]
{
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \begin{beamercolorbox}[sep=0.3cm,left,wd=\@tempdima]{frametitle}
    \usebeamerfont{frametitle}%
    \vbox{}\vskip-0.333333ex\insertframetitle\vphantom{g}\par%
  \end{beamercolorbox}%
  \vspace*{-4.333333ex}\hfill%
  \includegraphics[height=3ex]{logo-cg.pdf}\hspace{1ex}%
  \includegraphics[height=3ex]{logo-uni.pdf}\hspace*{-1ex}%
}

\setbeamerfont{structure}{series=\bfseries}
\setbeamerfont{block title}{size={}}
\setbeamerfont{tiny structure}{series=\bfseries}

\definecolor{cgblue}{rgb}{0.2,0.2,0.7}
\setbeamercolor{structure}{fg=cgblue}

\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
\setbeamercolor{block title alerted}{use=alerted text,fg=alerted text.fg,bg=alerted text.fg!20!bg}
\setbeamercolor{block title example}{use=example text,fg=example text.fg,bg=example text.fg!20!bg}

\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg}
\setbeamercolor{block body alerted}{parent=normal text,use=block title alerted,bg=block title alerted.bg!50!bg}
\setbeamercolor{block body example}{parent=normal text,use=block title example,bg=block title example.bg!50!bg}

\setbeamercolor*{palette primary}{use=structure,fg=black,bg=structure.fg!40!white}
\setbeamercolor*{palette secondary}{use=structure,fg=white,bg=structure.fg!60!white}
\setbeamercolor*{palette tertiary}{use=structure,fg=white,bg=structure.fg!90!white}
\setbeamercolor*{palette quaternary}{fg=white,bg=black}

\setbeamercolor*{sidebar}{use=structure,bg=structure.fg}

\setbeamercolor*{palette sidebar primary}{use=structure,fg=structure.fg!10}
\setbeamercolor*{palette sidebar secondary}{fg=white}
\setbeamercolor*{palette sidebar tertiary}{use=structure,fg=structure.fg!50}
\setbeamercolor*{palette sidebar quaternary}{fg=white}

\setbeamercolor*{titlelike}{parent=palette primary}

\setbeamercolor*{separation line}{}
\setbeamercolor*{fine separation line}{}

\setbeamercolor*{author in head/foot}{parent=palette primary}
\setbeamercolor*{title in head/foot}{parent=palette primary}
\setbeamercolor*{date in head/foot}{parent=palette primary}

\setbeamercolor*{section in head/foot}{parent=palette primary}
\setbeamercolor*{subsection in head/foot}{parent=palette primary}

\defbeamertemplate*{footline}{infolines theme}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.2\paperwidth,ht=2.25ex,dp=1ex,left]{author in head/foot}%
    \usebeamerfont{author in head/foot}\hspace*{2ex}\insertshortauthor
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.6\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.2\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}{\insertframenumber}{}% / \inserttotalframenumber
    \hspace*{2ex}
  \end{beamercolorbox}}%
  \vskip0pt%
}

\defbeamertemplate*{headline}{infolines theme}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{section in head/foot}%
    \usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left]{subsection in head/foot}%
    \usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertsubsectionhead
  \end{beamercolorbox}}%
  \vskip0pt%
}

\setbeamersize{text margin left=1em,text margin right=1em}

%\usesubitemizeitemtemplate{%
%    \tiny\raise1.5pt\hbox{\color{beamerstructure}$\blacktriangleright$}%
%}
%\usesubsubitemizeitemtemplate{%
%    \tiny\raise1.5pt\hbox{\color{beamerstructure}$\bigstar$}%
%}

\setbeamersize{text margin left=1em,text margin right=1em}

\ifbeamer@secheader\else\setbeamertemplate{headline}[default]\fi

\mode
<all>
